package com.team11.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.team11.server.mapper.SkInformationMapper;
import com.team11.server.pojo.dto.RespPageBean;
import com.team11.server.pojo.SkInformation;
import com.team11.server.pojo.dto.SkRecord;
import com.team11.server.pojo.dto.vo.SkRecordVo;
import com.team11.server.service.ISkInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author pjc
 * @since 2021-06-14
 */
@Service
public class SkInformationServiceImpl extends ServiceImpl<SkInformationMapper, SkInformation> implements ISkInformationService {

    @Resource
    private SkInformationMapper skInformationMapper;

    /**
     * 获取上课记录(分页)
     * @param currentPage
     * @param size
     * @param skRecordVo
     * @return
     */
    @Override
    public RespPageBean getSkRecordByPage(Integer currentPage, Integer size,SkRecordVo skRecordVo) {
        //开启分页
        Page<SkRecord> page = new Page<>(currentPage, size);
        IPage<SkRecord> skRecordByPage = skInformationMapper.getSkRecordByPage(page, skRecordVo);
        RespPageBean respPageBean =new RespPageBean(skRecordByPage.getTotal(),skRecordByPage.getRecords());
        return respPageBean;
    }



}
